package com.job.yangshida.homework0715;

import java.util.Arrays;

/**
 * @author 杨士达
 * @version 1.0
 * @since 2022-07-16 12:55:46
 */
public class String3 {
    public static void main(String[] args) {
        String s="we eat watermelon**";
        System.out.println(s.replace('*', '-'));
        System.out.println(s.replace("we", "black"));
        //f分割split
        System.out.println(Arrays.toString(s.split(" ")));
        String s2=s.replace("we", "black");
        System.out.println(Arrays.toString(s2.split(" ", 2)));
        //substring截取c从开始下标到最后
        System.out.println(s.substring(2).toUpperCase());
        //substring截取c从开始下标到jieshu结束下标
        System.out.println(s.substring(1, 3));
        //trim去前后空格
        String s1=" 啦 啦 啦 ";
        System.out.println("s1的长度是"+s1.length());
        String s3=s1.trim();
        System.out.println("s3的长度是"+s3.length());

    }
}
